package ma.model;

import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

import ma.model.auxillary.Parameter;
import ma.model.auxillary.ParameterList;

public interface ManufacturingMethodInterface extends ResultModelInterface {
    
    /**
     * To get the name of this manufacturing method.
     * @return name of manufacturing method
     */
    public String getName();
    
    /**
     * To get all parameters of this manufacturing method.
     * @return
     */
    public ParameterList getParameters();
    
    /**
     * To set an identifying name for this manufacturing method.
     * @param name name of this manufacturing method.
     */
    public void setName(String name);
    
    /**
     * To get the sub type of manufacturing method.
     * @return sub type of manufacturing method.
     */
    public SubType getSubType();
    
    /**
     * To get the super type of manufacturing method.
     * @return super type of manufacturing method.
     */
    public SuperType getSuperType();
    
    /**
     * To retrieve all parameters that are valid for the whole process.
     * @return the process parameters.
     */
    public List<Parameter> getProcessParameters();
    
    /**
     * To retrieve all material parameters of this process.
     * @return the material parameters.
     */
    public List<Parameter> getMaterialParameters();
    
    /**
     * To retrieve all geometry parameters of this process.
     * @return the geometry parameters.
     */
    public List<Parameter> getGeometryParameters();
    
    /**
     * To retrieve all parameters that deal with the process' tools.
     * @return the tool parameters.
     */
    public List<Parameter> getTools();
    
    /**
     * To get a specific parameter.
     * @param abbreviation abbreviation of parameter to retrieve.
     * @return <b>parameter</b> to retrieve.     
     * @throws NoSuchElementException when parameter was not found.
     */
    public Parameter getParameter(String abbreviation)
            throws NoSuchElementException;
    
    /**
     * To set a parameter's value.
     * @param param parameter to be changed.
     * @param value value of parameter to be set.
     */
    public void setParameter(Parameter param, Double value);
    
    /**
     * To get a specific parameter from a parameter set.
     * @param abbreviation abbreviation of parameter type
     * @param index index of parameter set
     * @return parameter of given type and set index
     */
    public Parameter getParameter(String abbreviation, int index);
    
    /**
     * To get the number of parameters of this {@code ManufacturingMethod}
     * that have to be set by the user.
     * @return number of user set parameters.
     */
    public int getUserSetParametersCount();
    
    /**
     * To get the number of geometry sets set.
     * @return number of geometry sets set.
     */
    public int getSetCount();
    
    /**
     * To get the maximum allowed number of geometry sets to be set.
     * @return maximum allowed number of geometry sets to be set.
     */
    public int getMaxGeometrySets();
    
    /**
     * To add an empty geometry set to this manufacturing method.
     * @throws IndexOutOfBoundsException when maximum number of geometry
     * sets to be added is reached.
     */
    public void addGeometrySet();
    
    /**
     * To remove a geometry set and &ndash; if they exist &ndash; it's
     * dependent parameters from this {@code ManufacturingMethod}.
     * @throws IndexOutOfBoundsException when trying to remove a set and this
     * method contains only one geometry set.
     */
    public void removeGeometrySet() throws IndexOutOfBoundsException;
    
    /**
     * To get all dependent parameters of a parameter set by a given index.
     * @param index index of elements to retrieve.
     * @return list that contains all elements.
     */
    public ArrayList<Parameter> getParametersByIndex(int index);
    
    /**
     * Whether all parameters that have to be set by the user are set or not.
     * @return <b>true</b> when all parameters are set.
     */
    public boolean allSet();
    
    
    /**
     * This enum class holds all available manufacturing methods by
     * <b>DIN 8580</b>.
     * @author Oliver Eckstein
     *
     */
    public enum SubType {
        TURNING, DRILLING, MILLING
    }
    
    /**
     * This enum class holds all super types of manufacturing methods by
     * <b>DIN 8580</b>.
     * @author Oliver Eckstein
     *
     */
    public enum SuperType {
        MANUFACTURING_GEOMETRICALLY_DEFINED_EDGES
    }
    
    /**
     * To start the calculation to gain the minimum energy consumption.
     * @return returns {@code false} when calculation failed.
     */    
    public boolean calculate();
    
    /**
     * To get the resulting energy values of this manufacturing method.
     * @return the resulting energy values.
     */
    public List<Parameter> getShortResults();
    
    /**
     * To get the name for the geometry set of this manufacturing method.
     * @return the method's geometry set name.
     */
    public String getSetName();
}
